﻿<Window x:Class="CPPEI.Coolzon.Designer.Views.OrderSetWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:lib="clr-namespace:CPPEI.Coolzon.Designer.Views"
        Title="设置场景展示流程" Height="400" Width="600" WindowStartupLocation="CenterScreen" ResizeMode="NoResize"
        Style="{DynamicResource WindowStyle}">
    <Window.Resources>
        <lib:DataControl x:Key="dataControl"></lib:DataControl>
        
        <DataTemplate x:Key="ScenesTemplate">
            <ComboBox
                  DisplayMemberPath="Caption"          
                  SelectedValuePath="Name"        
                  VerticalContentAlignment="Center"
                  ItemsSource="{Binding Source={StaticResource dataControl},Path=Scenes}">
            </ComboBox>
        </DataTemplate>
    </Window.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition></ColumnDefinition>
            <ColumnDefinition></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"></RowDefinition>
            <RowDefinition></RowDefinition>
            <RowDefinition Height="50"></RowDefinition>
        </Grid.RowDefinitions>
        <StackPanel Style="{DynamicResource ButtonPanelBackground}" Grid.ColumnSpan="2" Grid.Row="0"   VerticalAlignment="Center" Orientation="Horizontal">
            <Button Name="btnAdd" Style="{DynamicResource AddButtonStyle}" Width="100" Height="30" Margin="10" Click="btnAdd_Click"></Button>
            <Button Name="btnDelete" Style="{DynamicResource RemoveButtonStyle}" Width="100" Height="30" Margin="10" Click="btnDelete_Click"></Button>
        </StackPanel>
        <DataGrid Name="dgDisplayflow" Grid.ColumnSpan="2" Grid.Row="1" AutoGenerateColumns="False" ItemsSource="{Binding}" CanUserAddRows="False">
            <DataGrid.Columns>
                <DataGridCheckBoxColumn Binding="{Binding Path=IsSelected,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type DataGridRow}}}">
                    <DataGridCheckBoxColumn.HeaderTemplate>
                        <DataTemplate>
                            <CheckBox x:Name="cb" Checked="ckbSelectedAll_Checked" Unchecked="ckbSelectedAll_Unchecked" IsChecked="False" />
                        </DataTemplate>
                    </DataGridCheckBoxColumn.HeaderTemplate>
                </DataGridCheckBoxColumn>
                <DataGridTextColumn Binding="{Binding Name}" Header="流程名称"></DataGridTextColumn>
                <DataGridTextColumn Binding="{Binding Caption}" Header="流程描述"></DataGridTextColumn>
                <DataGridComboBoxColumn Width="80" Header="当前场景" 
                                        DisplayMemberPath="Caption"
                                        SelectedItemBinding="{Binding CurrentScene}" 
                                        ItemsSource="{Binding Source={StaticResource dataControl},Path=Scenes}"/>
                <DataGridComboBoxColumn Width="80" Header="下一场景" 
                                        DisplayMemberPath="Caption"
                                        SelectedItemBinding="{Binding NextScene}" 
                                        ItemsSource="{Binding Source={StaticResource dataControl},Path=Scenes}"/>
            </DataGrid.Columns>
        </DataGrid>

        <StackPanel Grid.ColumnSpan="2" Grid.Row="2" HorizontalAlignment="Left" VerticalAlignment="Center" Orientation="Horizontal">
            <Button Style="{DynamicResource  SubmitOrCancelButtonStyle}" Name="btnSubmit" Content="确 定" Width="100" Height="30" Margin="10" Click="btnSubmit_Click"></Button>
            <Button Style="{DynamicResource  SubmitOrCancelButtonStyle}" Name="btnClose" Content="取 消" Width="100" Height="30" Margin="10" Click="btnClose_Click" Visibility="Collapsed"></Button>
        </StackPanel>
        
    </Grid>
</Window>
